package pers.ervinse.shoppingmall.domain;

public class Res {
    private boolean success; // 是否成功
    private String message;  // 返回的消息
    private Object data;     // 返回的数据

    // 默认构造函数
    public Res() {}

    // 带参数的构造函数
    public Res(boolean success, String message, Object data) {
        this.success = success;
        this.message = message;
        this.data = data;
    }

    // Getter和Setter方法
    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    // 静态方法，表示成功的返回
    public static Res success(String message) {
        return new Res(true, message, null);
    }

    // 静态方法，表示失败的返回
    public static Res error(String message) {
        return new Res(false, message, null);
    }
}
